package Day02;

public class Day02reverseLeftWords {

    public String reverseLeftWords(String s, int n) {
        StringBuilder last = new StringBuilder();
        StringBuilder newString = new StringBuilder();
        char[] c = s.toCharArray();
        for (int i = 0; i<c.length;i++){
            if(i>=n){
                newString.append(c[i]);
            }else {
                last.append(c[i]);
            }
        }
        return newString.append(last).toString();
    }
    public String reverseLeftWords2(String s, int n){
        System.out.println(s.substring(n));
        System.out.println(s.substring(0,n));
        return s.substring(n) + s.substring(0, n);
    }
}
